package com.xma.springcloud.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: arthur
 * @License: (C) Copyright 2020-2028, xxx Corporation Limited.
 * @Contact: 413911174@qq.com
 * @Date: 2020/6/27 16:27
 * @Version: 1.0
 * @Description:
 */

@Configuration
public class GateWayConfig {


    @Bean
    public RouteLocator customRouteLocator(RouteLocatorBuilder routeLocatorBuilder){
        RouteLocatorBuilder.Builder routes = routeLocatorBuilder.routes();
        routes.route("path_route_xma",r -> r.path("/guonei").uri("http://news.baidu.com/guonei"))
                .route("path_route_xma",r -> r.path("/guoji").uri("http://news.baidu.com/guoji"));
        return routes.build();
    }
}
